package com.visceb.backstage.controller;
import com.visceb.backstage.dao.empRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.visceb.backstage.entity.Employee;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("employee")
@CrossOrigin()

public class empController {
    @Autowired
    private empRepository emprepository;

    @RequestMapping(value ="/findByDepart", method = RequestMethod.GET)
    @ResponseBody
    public List<Employee> subjectFind(String depart) {
//        System.out.println(subjectName);
        List<Employee> findSubject= emprepository.findAllByDepart(depart);
        return findSubject;
    }

    @RequestMapping(value ="/findByEmpId", method = RequestMethod.GET)
    @ResponseBody
    public Employee findByEmpId(String empid) {
//        System.out.println(subjectName);
        return emprepository.findByEmpId(empid);
    }
}
